package hn.cch.framework.openjdk;

import jdk.nashorn.internal.ir.debug.ObjectSizeCalculator;
import org.openjdk.jol.info.ClassLayout;
import org.openjdk.jol.vm.VM;

public class JolTest {

    public static void main(String[] args) {

        double[] array0 = new double[]{0.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0};
        double[] array1 = new double[]{0.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0};
        double[][] array = new double[2][11];
        array[0] = array0;
        array[1] = array1;
        System.out.println(ClassLayout.parseInstance(array).toPrintable());
        System.out.println(ClassLayout.parseInstance(array[0]).toPrintable());
        System.out.println(ClassLayout.parseInstance(array[1]).toPrintable());

        System.out.println("array[2][11]:" + ObjectSizeCalculator.getObjectSize(array));

        // 获取内存地址
        long l = VM.current().addressOf(array);
        String hexString = Long.toHexString(l);
        System.out.println(hexString);

    }
}
